package com.example.myapplication

import android.annotation.SuppressLint
import android.content.Intent
import android.database.sqlite.SQLiteDatabase
import android.opengl.GLSurfaceView
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager2.widget.ViewPager2
import com.example.total.R


class DetailPageActivity : AppCompatActivity() {
    private val data = listOf(R.drawable.monalisa1,R.drawable.monalisa2,R.drawable.monalisa3,R.drawable.monalisa4)
    private lateinit var mGLView: GLSurfaceView
    val list = mutableListOf<String>()
    override fun onCreate(savedInstanceState: Bundle?) {
//        startActivity(intent)
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_detail_page)
        MyQueryHelper.queryDataById(this, "09")
        val viewPager = findViewById<ViewPager2>(R.id.view_pager)
        viewPager.adapter = MyAdapter(data)
        var button=findViewById<Button>(R.id.button)
        var textview=findViewById<TextView>(R.id.textView)
        textview.text=MyQueryHelper.list[0]
        var textview2=findViewById<TextView>(R.id.textView2)
        textview2.text=MyQueryHelper.list[9]
        var textview3=findViewById<TextView>(R.id.textView3)
        textview3.text=MyQueryHelper.list[10]
        var textview5=findViewById<TextView>(R.id.textView5)
        textview5.text=MyQueryHelper.list[11]
        var textView6=findViewById<TextView>(R.id.textView6)
        textView6.text=MyQueryHelper.list[12]
        Log.d("MainActivity", list.toString())
        val intent=Intent(this,ModelActivity::class.java)
        val intent1=Intent(this,DatabasePageActivity::class.java)
//        startActivity(intent1)
        button.setOnClickListener {
            startActivity(intent)
        }

    }override fun onCreateOptionsMenu(menu: Menu?): Boolean {
        menuInflater.inflate(R.menu.toolbar, menu)
        return true
    }
    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        when (item.itemId) {
            R.id.backup -> Toast.makeText(this, "You clicked Backup",
                Toast.LENGTH_SHORT).show()
        }
        return true
    }
}

